
#include "EventLoop.h"
#include "Channel.h"
#include "Poller.h"

EventLoop::EventLoop() { m_poller = std::make_unique<Poller>(); }

EventLoop::~EventLoop() {}

void EventLoop::Loop() const {
  while (true) {
    for (Channel *active_ch : m_poller->Poll()) {
      active_ch->HandleEvent();
    }
  }
}

void EventLoop::UpdateChannel(Channel *ch) const { m_poller->UpdateChannel(ch); }

void EventLoop::DeleteChannel(Channel *ch) const { m_poller->DeleteChannel(ch); }
